package cn.stylefeng.guns.modular.biz.controller;

import cn.stylefeng.guns.modular.biz.entity.LabMainInfoRlm;
import cn.stylefeng.guns.modular.biz.pojo.request.LabMainInfoRlmRequest;
import cn.stylefeng.guns.modular.biz.service.LabMainInfoRlmService;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.List;

/**
 * MES煤的入炉煤质检数据控制器
 *
 * @author 张朋飞
 * @since 2024/10/31 17:00
 */
@RestController
@ApiResource(name = "MES煤的入炉煤质检数据")
public class LabMainInfoRlmController {

    @Resource
    private LabMainInfoRlmService labMainInfoRlmService;

    /**
     * 添加MES煤的入炉煤质检数据
     *
     * @author 张朋飞
     * @since 2024/10/31 17:00
     */
    @PostResource(name = "添加MES煤的入炉煤质检数据", path = "/labMainInfoRlm/add")
    public ResponseData<LabMainInfoRlm> add(@RequestBody @Validated(LabMainInfoRlmRequest.add.class) LabMainInfoRlmRequest labMainInfoRlmRequest) {
        labMainInfoRlmService.add(labMainInfoRlmRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 删除MES煤的入炉煤质检数据
     *
     * @author 张朋飞
     * @since 2024/10/31 17:00
     */
    @PostResource(name = "删除MES煤的入炉煤质检数据", path = "/labMainInfoRlm/delete")
    public ResponseData<?> delete(@RequestBody @Validated(LabMainInfoRlmRequest.delete.class) LabMainInfoRlmRequest labMainInfoRlmRequest) {
        labMainInfoRlmService.del(labMainInfoRlmRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 批量删除MES煤的入炉煤质检数据
     *
     * @author 张朋飞
     * @since 2024/10/31 17:00
     */
    @PostResource(name = "批量删除MES煤的入炉煤质检数据", path = "/labMainInfoRlm/batchDelete")
    public ResponseData<?> batchDelete(@RequestBody @Validated(BaseRequest.batchDelete.class) LabMainInfoRlmRequest labMainInfoRlmRequest) {
        labMainInfoRlmService.batchDelete(labMainInfoRlmRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑MES煤的入炉煤质检数据
     *
     * @author 张朋飞
     * @since 2024/10/31 17:00
     */
    @PostResource(name = "编辑MES煤的入炉煤质检数据", path = "/labMainInfoRlm/edit")
    public ResponseData<?> edit(@RequestBody @Validated(LabMainInfoRlmRequest.edit.class) LabMainInfoRlmRequest labMainInfoRlmRequest) {
        labMainInfoRlmService.edit(labMainInfoRlmRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看MES煤的入炉煤质检数据详情
     *
     * @author 张朋飞
     * @since 2024/10/31 17:00
     */
    @GetResource(name = "查看MES煤的入炉煤质检数据详情", path = "/labMainInfoRlm/detail")
    public ResponseData<LabMainInfoRlm> detail(@Validated(LabMainInfoRlmRequest.detail.class) LabMainInfoRlmRequest labMainInfoRlmRequest) {
        return new SuccessResponseData<>(labMainInfoRlmService.detail(labMainInfoRlmRequest));
    }

    /**
     * 获取MES煤的入炉煤质检数据列表
     *
     * @author 张朋飞
     * @since 2024/10/31 17:00
     */
    @GetResource(name = "获取MES煤的入炉煤质检数据列表", path = "/labMainInfoRlm/list")
    public ResponseData<List<LabMainInfoRlm>> list(LabMainInfoRlmRequest labMainInfoRlmRequest) {
        return new SuccessResponseData<>(labMainInfoRlmService.findList(labMainInfoRlmRequest));
    }

    /**
     * 获取MES煤的入炉煤质检数据列表（带分页）
     *
     * @author 张朋飞
     * @since 2024/10/31 17:00
     */
    @GetResource(name = "获取MES煤的入炉煤质检数据列表（带分页）", path = "/labMainInfoRlm/page")
    public ResponseData<PageResult<LabMainInfoRlm>> page(LabMainInfoRlmRequest labMainInfoRlmRequest) {
        return new SuccessResponseData<>(labMainInfoRlmService.findPage(labMainInfoRlmRequest));
    }

}
